import java.util.ArrayList;
import java.util.List;

import org.testng.AssertJUnit;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;


public class TestRockPapersScissors {
	
	private RockPaperScissors rps;
	private ArrayList<RPSEnum> list1 = new ArrayList<RPSEnum>() ;
	private ArrayList<RPSEnum> list2 = new ArrayList<RPSEnum>() ;
	
	
	@BeforeClass
	void setUpClass(){
		rps = new RockPaperScissors();
		
		list1.add(RPSEnum.PAPER);
		list1.add(RPSEnum.ROCK);
		list1.add(RPSEnum.SCISSORS);
		list1.add(RPSEnum.ROCK);
		list1.add(RPSEnum.PAPER);
		list1.add(RPSEnum.ROCK);
		list1.add(RPSEnum.SCISSORS);
		list1.add(RPSEnum.PAPER);
		list1.add(RPSEnum.ROCK);
		list1.add(RPSEnum.SCISSORS);
		
		list2.add(RPSEnum.PAPER);
		list2.add(RPSEnum.ROCK);
		list2.add(RPSEnum.SCISSORS);
		list2.add(RPSEnum.PAPER);
		list2.add(RPSEnum.PAPER);
		list2.add(RPSEnum.ROCK);
		list2.add(RPSEnum.SCISSORS);
		list2.add(RPSEnum.PAPER);
		list2.add(RPSEnum.SCISSORS);
		list2.add(RPSEnum.PAPER);
		

		
		
	}
	
	@AfterClass
	void tearDownClass(){
		
		rps = null;
		list1 = null;
		list2 = null;
		
		
	}
	
	@Test//(dataProvider = "testPlayer")
	public void testWinPlayer(){
	
		int size = 10;
		
		Player p1 = new Player("Sami",list1);
		
		Player p2 = new Player("Thibault",list2);
		
		assert Result.WIN.equals(rps.play(p1, p2));

		
	}
	
	@Test//(dataProvider = "testPlayer")
	public void testTiePlayer(){
	
		int size = 10;
		
		Player p1 = new Player("Sami",list1);
		
		Player p2 = new Player("Thibault",list1);
		
		assert Result.TIE.equals(rps.play(p1, p2));

		
	}
	
	@Test//(dataProvider = "testPlayer")
	public void testLostPlayer(){
	
		int size = 10;
		
		Player p1 = new Player("Sami",list2);
		
		Player p2 = new Player("Thibault",list1);
		
		assert Result.LOST.equals(rps.play(p1, p2));

		
	}
	
	@Test
	public void testRandPlayer(){
		
		int size = 10;
		
		Player p1 = new Player("Sami",list2);
		
		Player p2 = new Player("Thibault",list1);
		
		assert Result.LOST.equals(rps.play(p1, p2));

		
	}
	
	
	
	
	
	@Test (dataProvider = "testWin")
	public void testWinPlay(RPSEnum p1, RPSEnum p2){
		
		assert Result.WIN.equals(rps.play(RPSEnum.PAPER, RPSEnum.ROCK));

		
		
	}
	
	@Test (dataProvider = "testTie")
	void testTiePlay(RPSEnum p1, RPSEnum p2){
		
		assert Result.TIE.equals(rps.play(RPSEnum.ROCK, RPSEnum.ROCK));
		
		
		
	}
	
	@Test (dataProvider = "testLost")
	void testLostPlay(RPSEnum p1, RPSEnum p2){
		
		assert Result.LOST.equals(rps.play(RPSEnum.SCISSORS, RPSEnum.ROCK));

		
	}
	
	
	@DataProvider(name = "testWin")
	public Object[][] createWinData(){
		
		
		return new Object[][]{
				
				{RPSEnum.SCISSORS,RPSEnum.PAPER},
				{RPSEnum.ROCK,RPSEnum.SCISSORS},
				{RPSEnum.PAPER,RPSEnum.ROCK},
				
		};
		
		
	}
	
	@DataProvider(name = "testTie")
	public Object[][] createTieData(){
		
return new Object[][]{
				
				{RPSEnum.SCISSORS,RPSEnum.SCISSORS},
				{RPSEnum.ROCK,RPSEnum.ROCK},
				{RPSEnum.PAPER,RPSEnum.PAPER},	
		};
		
	}
	
	@DataProvider(name = "testLost")
	public Object[][] createLostData(){
		
return new Object[][]{
				
				{RPSEnum.PAPER,RPSEnum.SCISSORS},
				{RPSEnum.SCISSORS,RPSEnum.ROCK},
				{RPSEnum.ROCK,RPSEnum.PAPER},
		};
		
	}
	
	@DataProvider(name = "testPlayer")
	public Object[][] createPlayerData(){
		
return new Object[][]{
				
				{RPSEnum.PAPER,RPSEnum.SCISSORS},
				{RPSEnum.SCISSORS,RPSEnum.ROCK},
				{RPSEnum.ROCK,RPSEnum.PAPER},
				{RPSEnum.ROCK,RPSEnum.PAPER},
				{RPSEnum.ROCK,RPSEnum.PAPER},
				{RPSEnum.ROCK,RPSEnum.PAPER},
				{RPSEnum.ROCK,RPSEnum.PAPER},
				{RPSEnum.ROCK,RPSEnum.PAPER},
				{RPSEnum.ROCK,RPSEnum.PAPER},
				{RPSEnum.ROCK,RPSEnum.PAPER},
		};
		
	}

}
